<%@ page pageEncoding="UTF-8"%>
<%@ include file="/common/token.jsp"%>
<%@ include file="/common/user.jsp"%>
<%
    Integer pid = input.getInt("pid", -1);
    UserProfile userProfile = UserProfile.fromMap(parameters, UserProfile.class);
    userProfile.setId(pid);
    List<UserProfile> userProfiles = QBuilder.db("basedb").select().from("UserProfile").where(new Where("hospital=", hospital).and("status = ", STATUS_ENABLE).and("id=", userProfile.getId()).and("uid=", token.getUid()).and("self=", FAMILY)).query().getResultObj();
    if (isEmpty(userProfiles)) {
      Tools.encryptPrint(out, new Message(30041, "亲属信息不存在"));
      return;
    }
    UserProfile oldUserProfile = userProfiles.get(0);
    oldUserProfile.setStatus(STATUS_DISABLE);
    DBTools.db("basedb").modItem(oldUserProfile, oldUserProfile.getId());
    Integer uid = token.getUid();
    List<Map> family = family(uid, hospital);
    if (isEmpty(family)) {
      msg = new Message(30041, "暂未添加就诊人");
    }
    msg.put("data", family);
    Tools.encryptPrint(out, msg);
%>
